﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LxLESS
{
    public class LESSJoint
    {
        public List<MGJoint> MGJoints { get; set; } = new List<MGJoint>();
        public BiCGStabZone O_BiCGZone;
        public BiCGStabZone N_BiCGZone;
        public void CheckCreate(IBuildMGJoint startJoint, LESSZone oZone, int oThreadID, LESSZone nZone, int nThreadID)
        {
            //网格
            MGJoints.Clear();
            MGJointCreator jointCreator = new MGJointCreator();
            MGJoint con = jointCreator.CreateMGJoint(startJoint,
                 oZone.MGZones[0], oZone.MGZones[0].Bounds[oThreadID],
                 nZone.MGZones[0], nZone.MGZones[0].Bounds[nThreadID]);
            MGJoints.Add(con);
            for (int i1 = 1; i1 < AMGGlobal.MaxLevel; i1++)
            {
                MGJoint c = jointCreator.CreateMGJoint(MGJoints[i1 - 1],
                oZone.MGZones[i1], oZone.MGZones[i1].Bounds[oThreadID],
                nZone.MGZones[i1], nZone.MGZones[i1].Bounds[nThreadID]);
                MGJoints.Add(c);
            }
            //设置数组
            foreach (var c in MGJoints)
            {
                c.SetArray(this);
            }
            //
            O_BiCGZone = oZone.BiCGZone;
            N_BiCGZone = nZone.BiCGZone;
        }


    }
}
//public void CreateMGJoints(IBuildMGJoint startJoint, LESSZone oZoneAMG, int oThreadID, LESSZone nZoneAMG, int nThreadID)
//{

//}
//public void CreateBiCGJoint(LESSZone oZone, LESSZone nZone)
//{

//}
//MGJoints[0].SetArray(this);
//for (int i1 = 1; i1 < MGJoints.Count; i1++)
//{
//    MGJoints[i1].SetArray(this);
//}
//public void LinkToMatrix(IAMGSolvableJoint connect)
//{
//    MGJoints[0].SetFineJoint(connect);
//    IsNeededUpdateA = true;
//}
//public void Restrict(ThreadInfo threadInfo)
//{
//    MGJoints[SolvingLevel].Restrict_ALU(threadInfo);
//}
//public void Copy_xArray(ThreadInfo threadInfo)
//{
//    MGJoints[SolvingLevel].Copy_xArray(threadInfo);
//}
//public void Copy_xCommonArray(ThreadInfo threadInfo)
//{
//    MGJoints[SolvingLevel].Copy_xCommonArray(threadInfo);
//}
//public void Copy_yArray(ThreadInfo threadInfo)
//{
//    MGJoints[SolvingLevel].Copy_yArray(threadInfo);
//}
//public void Copy_zArray(ThreadInfo threadInfo)
//{
//    MGJoints[SolvingLevel].Copy_zArray(threadInfo);
//}